#
#    Copyright (C) 2016 Francisco Javier Parra <franparpe@openmailbox.org>
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
#


def ShowCurvatureRadiusFailures(E0Radius,
                                anglesL0Radius,
                                pointsE0Radius,
                                pointsL0Radius):
    """This function prints wether or not the outline
is capable of being used for the current application
    Keyword Arguments:
    radiusE0 -- 
    radiusL0 -- 
    """
    if E0Radius:
        print("[*] Warning, there is a peak in the following angle:")
        print("[Radius]--> ", E0Radius)
        print("[Points]--> ", pointsE0Radius)
    elif anglesL0Radius:
        print("[*] Warning, there is a rebaje in the following angle:")
        print("[Angles]--> ", anglesL0Radius)
        print("[Points]--> ", pointsL0Radius)
    else:
        pass


def ShowCurvatureRadiusFailuresCircular(peakAngles,
                                        negAngles,
                                        noContactAngles,
                                        peakPoints,
                                        negPoints,
                                        noContactPoints):
    """Prints where the radius of curvature fails.
It only works on followers with circular contact
    Keyword Arguments:
    noContactAngles -- 
    peakAngles      -- 
    negAngles       -- 
    """
    if peakAngles:
        print("[*] Warning, there is a peak in the following angle:")
        print("[Angles]--> ", peakAngles)
        print("[Points]--> ", peakPoints)
    elif negAngles:
        print("[*] Warning, there is a rebaje in the following angle:")
        print("[Angles]--> ", negAngles)
        print("[Points]--> ", negPoints)
    elif noContactAngles:
        print("[*] Warning, in the following angles, there is\
 no proper contact with the cam")
        print("[Angles]--> ", noContactAngles)
        print("[Points]--> ", noContactPoints)


def ShowPressureAngleFailuresCircular(pressureAngles,
                                      badPressureAngles,
                                      badPressurePoints):
    """Prints where there have been problems with angle of pressure
    Keyword Arguments:
    badPressureAngles -- A list that contains all points where
the angle is greater than 30 degrees
    """
    if badPressureAngles:
        print("[*] Warning, there are parts on the cam whose\
 pressure angle is above 30 degrees")
        print("[Pressure Angle]-->", pressureAngles)
        print("[Angles]--> ", badPressureAngles)
        print("[Points]--> ", badPressurePoints)
    else:
        pass


def ShowCurvatureRadiusFailuresConjugatePlane(radiusOfCurvE0Sup,
                                              radiusOfCurvL0Sup,
                                              pointsE0RadiusSup,
                                              pointsL0RadiusSup,
                                              radiusOfCurvE0Inf,
                                              radiusOfCurvL0Inf,
                                              pointsE0RadiusInf,
                                              pointsL0RadiusInf):
    """This function prints wether or not the outline
is capable of being used for the current application
    Keyword Arguments:
    radiusE0 -- 
    radiusL0 -- 
    """
    if radiusOfCurvE0Sup:
        print("[*] Warning, there is a peak (outline1):")
        print("[Radius]--> ", radiusOfCurvE0Sup)
        print("[Points]--> ", pointsE0RadiusSup)
    elif radiusOfCurvL0Sup:
        print("[*] Warning, there is a rebaje (outline1):")
        print("[Angles]--> ", radiusOfCurvL0Sup)
        print("[Points]--> ", pointsL0RadiusSup)
    else:
        pass

    if radiusOfCurvE0Inf:
        print("[*] Warning, there is a peak (outline2):")
        print("[Radius]--> ", radiusOfCurvE0Inf)
        print("[Points]--> ", pointsE0RadiusInf)
    elif radiusOfCurvL0Inf:
        print("[*] Warning, there is a rebaje (outline2):")
        print("[Angles]--> ", radiusOfCurvL0Inf)
        print("[Points]--> ", pointsL0RadiusInf)
    else:
        pass


def ShowCurvatureRadiusFailuresConjugateCircular(peakRadiusOfCurvSup,
                                                 negRadiusOfCurvSup,
                                                 noContactRadiusOfCSup,
                                                 peakPointsSup,
                                                 negPointsSup,
                                                 noContactPointsSup,
                                                 peakRadiusOfCurfInf,
                                                 negRadiusOfCurvInf,
                                                 noContactRadiusOfCInf,
                                                 peakPointsInf,
                                                 negPointsInf,
                                                 noContactPointsInf):
    """Prints where the radius of curvature fails.
It only works on followers with circular contact
    Keyword Arguments:
    noContactAngles -- 
    peakAngles      -- 
    negAngles       -- 
    """
    if peakRadiusOfCurvSup:
        print("[*] Warning, there is a peak in the following angle:")
        print("[Radius]--> ", peakRadiusOfCurvSup)
        print("[Points]--> ", peakPointsSup)
    elif negRadiusOfCurvSup:
        print("[*] Warning, there is a rebaje in the following angle:")
        print("[Angles]--> ", negRadiusOfCurvSup)
        print("[Points]--> ", negPointsSup)
    elif noContactRadiusOfCSup:
        print("[*] Warning, in the following angles, there is\
 no proper contact with the cam")
        print("[Angles]--> ", noContactRadiusOfCSup)
        print("[Points]--> ", noContactPointsSup)

    # Lower part
    if peakRadiusOfCurfInf:
        print("[*] Warning, there is a peak in the following angle:")
        print("[Radius]--> ", peakRadiusOfCurfInf)
        print("[Points]--> ", peakPointsInf)
    elif negRadiusOfCurvInf:
        print("[*] Warning, there is a rebaje in the following angle:")
        print("[Angles]--> ", negRadiusOfCurvInf)
        print("[Points]--> ", negPointsInf)
    elif noContactRadiusOfCInf:
        print("[*] Warning, in the following angles, there is\
 no proper contact with the cam")
        print("[Angles]--> ", noContactRadiusOfCInf)
        print("[Points]--> ", noContactPointsInf)


def ShowPressureAngleFailuresConjugateCircular(badPressureAnglesSup,
                                               badPressurePointsSup,
                                               badPressureAnglesInf,
                                               badPressurePointsInf):
    """Prints where there have been problems with angle of pressure
    Keyword Arguments:
    badPressureAngles -- A list that contains all points where
the angle is greater than 30 degrees
    """
    if badPressureAnglesSup:
        print("[*] Warning, there are parts on the cam whose\
        pressure angle is above 30 degrees (Outline 1)")
        print("[Angles]--> ", badPressureAnglesSup)
        print("[Points]--> ", badPressurePointsSup)
    else:
        pass

    # Lower Part
    if badPressureAnglesInf:
        print("[*] Warning, there are parts on the cam whose\
        pressure angle is above 30 degrees (Outline 2)")
        print("[Angles]--> ", badPressureAnglesInf)
        print("[Points]--> ", badPressurePointsInf)
    else:
        pass
